/*
 * 1.2
 * Write code to reverse a C-Style String. (C-String means that “abcd” is represented as
 * five characters, including the null character.)
 */
#include <stdio.h>
#include <string.h>

void reverse(char *str)
{
    int len = strlen(str);
    for (int i = 0; i < len/2; i++) {
        char c = str[i];
        str[i] = str[len-1-i];
        str[len-1-i] = c;
    }
}

int main()
{
    char s[] = "a";
    reverse(s);
    printf("%s\n", s);
    char s2[] = "abcd";
    reverse(s2);
    printf("%s\n", s2);
    char s3[] = "abcde";
    reverse(s3);
    printf("%s\n", s3);
}
